cmake_minimum_required(VERSION 3.16)
project(mqtt_test)

set(project_name mqtt_test)
set(project_root ${PROJECT_SOURCE_DIR})
set(project_include ${project_root}/include)
set(project_src ${project_root}/src)
set(project_lib ${project_root}/lib)
set(EXECUTABLE_OUTPUT_PATH ${project_root}/bin)
#
#set(common_src /home/wangxin/src/common/common_util_code)
#set(common_lib /home/wangxin/src/common/common_util_lib/x86_ubuntu20.04)

add_definitions(-DENABLE_UUID)

set(CMAKE_CXX_STANDARD 11)
add_definitions(-std=c++11)

set(CMAKE_BUILD_TYPE DEBUG)
set(CMAKE_CXX_FLAGS_DEBUG "$ENV{CXXFLAGS} -O0 -Wall -g -ggdb -fpermissive")
set(CMAKE_CXX_FLAGS_RELEASE "$ENV{CXXFLAGS} -O3 -Wall")


include_directories(
        ${project_root}/paho.mqtt/include
        ${project_root}/libmqttclient/include
        ${project_root}/libmqttclient/include/common
        ${project_root}/libmqttclient/include/common/log
        ${project_root}/libmqttclient/include/config
        ${project_root}/libmqttclient/include/mbedtls
        ${project_root}/libmqttclient/include/mqtt
        ${project_root}/libmqttclient/include/mqttclient
        ${project_root}/libmqttclient/include/network
        ${project_root}/libmqttclient/include/platform
        ${project_root}/libmqttclient/include/platform/linux


)

link_directories(
        ${project_root}/paho.mqtt/lib
        ${project_root}/libmqttclient/lib
)

#add_executable(mqtt_test src/emqx.cpp)
add_executable(mqtt_test temp/main.cpp)

target_link_libraries(mqtt_test ${CMAKE_DL_LIBS}
        libpaho-mqtt3a.a
        libpaho-mqtt3as.a
        libpaho-mqtt3c.a
        libpaho-mqttpp3.a
        libpaho-mqtt3cs.a
#        libmqttclient.so
        -lpthread -ldl -lssl -lcrypto
        )